package cn.gson.boot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

@Entity
@Table(name = "purchase_details", schema = "boot", catalog = "")
public class PurchaseDetails {//采购从表
    private int purdetailsId;//从表id
    private Purchase purchaseId;//采购id
    private Productt producttId;//产品从表id
    private Integer purdetailsNumber;//采购数量
    private BigDecimal purdetailsPrice;//采购小计

    @Id
    @Column(name = "purdetails_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getPurdetailsId() {
        return purdetailsId;
    }

    public void setPurdetailsId(int purdetailsId) {
        this.purdetailsId = purdetailsId;
    }


    @ManyToOne
    @JoinColumn(name = "purchase_id", referencedColumnName = "purchase_id")
    public Purchase getPurchaseId() {
        return purchaseId;
    }

    public void setPurchaseId(Purchase purchaseId) {
        this.purchaseId = purchaseId;
    }

    @ManyToOne
    @JoinColumn(name = "productt_id", referencedColumnName = "productt_id")
    public Productt getProducttId() {
        return producttId;
    }

    public void setProducttId(Productt producttId) {
        this.producttId = producttId;
    }

    @Basic
    @Column(name = "purdetails_number")
    public Integer getPurdetailsNumber() {
        return purdetailsNumber;
    }

    public void setPurdetailsNumber(Integer purdetailsNumber) {
        this.purdetailsNumber = purdetailsNumber;
    }

    @Basic
    @Column(name = "purdetails_price")
    public BigDecimal getPurdetailsPrice() {
        return purdetailsPrice;
    }

    public void setPurdetailsPrice(BigDecimal purdetailsPrice) {
        this.purdetailsPrice = purdetailsPrice;
    }

    @Override
    public String toString() {
        return "PurchaseDetails{" +
                "purdetailsId=" + purdetailsId +
                ", purchaseId=" + purchaseId +
                ", producttId=" + producttId +
                ", purdetailsNumber=" + purdetailsNumber +
                ", purdetailsPrice=" + purdetailsPrice +
                '}';
    }
}
